package com.zyl.pts.config.enums;

import lombok.Getter;

/**
 * 统一响应状态码与响应消息的关系
 */
@Getter
public enum ResultCode {
    // 统一定义响应状态码与响应消息
    //成功
    SUCCESS(200, "success"),

    //10000-19999之间都为参数响应相关的响应
    PARAMS_INVALID(10000,"参数无效"),
    PAGE_PARAMS_INVALID(10001,"分页参数无效"),
    USERNAME_PARAMS_INVALID(10002,"请输入正确的用户名"),
    PASSWORD_PARAMS_INVALID(10003,"请输入正确的密码"),
    QRCODE_GEN_FAIL(10004,"二维码生成失败"),
    FILE_UPLOAD_FAIL(10005,"文件上传失败"),
    ERROR(500,"服务器内部错误"),

    //20000-29999都为用户相关的响应
    USER_IS_INVALID(20000,"该用户无效"),
    USERNAME_INVALID(20001,"该用户名不可用"),
    PASSWORD_INVALID(20002,"该密码不可用"),
    USER_IS_UNABLE(20003,"该用户被封禁"),
    USER_IS_NOT_EXIST(20004,"该用户不存在"),
    USER_IS_EXIST(20005,"该用户已经存在"),
    TOKEN_IS_MISS(20006,"用户未登录"),
    TOKEN_IS_TIMEOUT(20007,"登录已过期，请重新登录"),
    TOKEN_IS_INVALID(20008,"token令牌有误，请重新登录"),


    // 30000-39999 之间是和动物信息相关的响应
    ANIMAL_IS_NOT_EXIST(30000, "该动物不存在"),
    HURDLES_IS_NOT_EXIST(30001, "该栏圈不存在"),
    HURDLES_IS_FULL(30001, "栏圈已满，添加失败"),
    HURDLES_IS_EMPTY(30002, "栏圈已空，删除失败，请检查数据");

    private final int code;
    private final String message;

    // 枚举类的构造器只能是私有的
    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}
